Function Reference

_IELoadWait

Wait for a browser page load to complete before returning.

#include <IE.au3>
_IELoadWait ( ByRef $o_object [, $i_delay = 0 [, $i_timeout = -1]] )

 

Parameters

$o_object Object variable of an InternetExplorer.Application
$i_delay Optional: Milliseconds to wait before checking status
$i_timeout Optional: Period of time to wait before exiting function (default = 300000 ms aka 5 min)

 

Return Value

Success: Returns 1
Failure: Returns 0 and sets @ERROR
@Error: 0 ($_IEStatus_Success) = No Error
1 ($_IEStatus_GeneralError) = General Error
3 ($_IEStatus_InvalidDataType) = Invalid Data Type
4 ($_IEStatus_InvalidObjectType) = Invalid Object Type
6 ($_IEStatus_LoadWaitTimeout) = Load Wait Timeout
8 ($_IEStatus_AccessIsDenied) = Access Is Denied
@Extended: Contains invalid parameter number

 

Remarks

Several IE.au3 functions call _IELoadWait() automatically (e.g. _IECreate(), _IENavigate() etc.). Most functions that do this also allow you to turn this off with a $f_wait parameter if you do not want the wait or if you want to call it yourself.

Browser scripting security restrictions may sometimes prevent _IELoadWait from guaranteeing that a page is fully loaded and can occasionally result in untrapped errors. In these cases you may need to avoid calling _IELoadWait and attempt to employ other methods of insuring that the page load has completed. These methods might include using a Sleep command, examining browser status bar text and other methods. When using functions that call _IELoadWait for objects other than the InternetExplorer (browser) object, you may also be successful by calling _IELoadWait for the browser yourself (e.g. _IELoadWait($oIE)).

The most common causes of trouble are page redirects and cross-site scripting security restrictions associated with frames. Page re-writing techniques employed by some applications (e.g. Gmail) can also cause trouble here.

 

Related

_IELoadWaitTimeout, _IECreate, _IENavigate, _IEFormSubmit, _IELinkClickByText, _IELinkClickByIndex, _IEImgClick, _IEFormImageClick, _IEBodyWriteHTML, _IEDocWriteHTML, _IEAction

 

Example


; *******************************************************
; Example 1 - Open the AutoIt forum page, tab to the "View new posts"
;               link and activate the link with the enter key.
;               Then wait for the page load to complete before moving on.
; *******************************************************
;
#include <IE.au3>
$oIE = _IECreate ("http://www.autoitscript.com/forum/index.php")
Send("{TAB 12}")
Send("{ENTER}")
_IELoadWait ($oIE)